<html>
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=7">
		<meta http-equiv="content-type" content="text/html;charset=utf-8">
		<title>智器图书搜索 </title>
		<script src="js/jquery-1.7.1.min.js" type="text/javascript"></script>
		<script src="js/jquery.screw.js" type="text/javascript"></script>
		<script src="js/jquery.ui.core.js"></script>
		<script src="js/jquery.ui.widget.js"></script>
		<script src="js/jquery.ui.position.js"></script>
		<script src="js/jquery.ui.autocomplete.js"></script> 
		<script src="js/loading.js" type="text/javascript"></script>
		<link rel="stylesheet" href="css/base/jquery.ui.all.css">
		<style>
		.ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; }
		</style>
		<link rel="stylesheet" href="css/css.css" type="text/css" media="all" />
		<script type="text/javascript">
		//var sizeAjax;
		function load(rid,url,kid)
			{
			//alert(kid);
			var size='#size'+rid;
			$.ajax({
			type : "GET",
			url : "getSize.php",
			data : {
			url : url,
			rid:rid,
			kid:kid
			},
			success : function(data) {
			$(size).html(data);
			}
			});

			}
			function clearResult(){
			//$("#kw").val('');
			$("#container").empty();
			//$("body").abort();
			}
		$(function() {
						
			$( "#kw" ).autocomplete({
				 source: "search.php",
				 minLength: 1,
				// //select: function( event, ui ) {
					// //$( "#container" ).html(ui.item.id);
				// //}
			 });		
			$("#form1").screw({
			loadingHTML : '<img alt="Loading" src="images/ajax-loader-red.gif">'
			});
			$('#form1').ajaxStart(function(){
			    showloading();
			$("#su").attr("disabled", "true");
			});
			$('#form1').ajaxComplete(function(){
			    hideloading();//
			});
			$('#form1').ajaxStop(function(){			  
			$("#su").removeAttr("disabled");//在ajax停止的时候才能再次搜索
			});

			$("#form1").submit(function() {
			var keywords = $("#kw").val();
			if(!keywords) {
			$("#kw").focus();
			alert('请输入关键字');
			return false;
			}

			$.ajax({
			type : "GET",
			url : "getBook.php",
			data : {
			keywords : keywords
			},
			success : function(data) {
			//alert(data);
			if(0 == data || "gengxin" == data) {
			$.ajax({
			type : "GET",
			url : "getFrist.php",
			data : {
			keywords : keywords,
			update : data
			},
			success : function(data) {
			$("#container").html(data);
			$.ajax({
			type : "GET",
			url : "getMore.php",
			data : {
			keywords : keywords,
			state : 1
			},
			success : function(data) {
			$("#container").append(data);
			}
			});
			}
			});
			} else {
			$.ajax({
			type : "GET",
			url : "getMore.php",
			data : {
			keywords : keywords
			},
			success : function(data) {
			$("#container").html(data);

			}
			});
			}
			},
			//error: function() { alert("刷新太快！"); }
			});
			return false;
			});
			})</script>
	</head>
	<body link="#0000cc">
		<div id="out">
			<div id="in">
				<div id="wrapper">
					<div id="head">
						<form name="f"  id="form1" action="s" class="fm">
							<span class="s_ipt_wr">
								<input name="wd" id="kw" class="s_ipt" value="" maxlength="100" onclick="clearResult();">
							</span><span class="s_btn_wr">
								<input type="submit" id="su" value="搜索一下" class="s_btn">
							</span>
						</form>
					</div>
					<br>
					<div id="container"></div>
				</div>
			</div>
	</body>
</html>